#include<stdio.h>
#include<stdlib.h>
#include<fcntl.h>
#include<unistd.h>

#define LOCATION 10*1024

int main(int argc, char const *argv[])
{
    int fd = open("test.txt", O_WRONLY | O_CREAT | O_TRUNC, 0644);
    if(fd == -1){
        perror("open");
        return -1;
    }
    write(fd, "hello", 5);
    lseek(fd, LOCATION, SEEK_SET);
    write(fd, "hello", 5);
    long file_size = lseek(fd, 0, SEEK_END);
    printf("file size: %ld\n", file_size);
    close(fd);
    return 0;
}
